<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport"
        content="width=device-width,initial-scale=1.0,viewport-fit=cover,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
    <title>尤迈桃李会</title>
    <script src="js/rem.js"></script>
    <link rel="stylesheet" href="https://g.alicdn.com/de/prismplayer/2.8.2/skins/default/aliplayer-min.css" />
    <link rel="stylesheet" href="css/weui.min.css">
    <link rel="stylesheet" href="css/jquery-weui.min.css">
    <link rel="stylesheet" href="css/public.css">
    <link rel="stylesheet" href="css/index.css">
    <script>(function () { var _53code = document.createElement("script"); _53code.src = "https://tb.53kf.com/code/code/96d8f960b261e49515450f8953b044bc5/1"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(_53code, s); })();</script>
</head>

<body>
    <div class="pub_bar" title="尤迈桃李会" left="back"></div>
    <!--  -->
    <div class="pub-container has-tabbar bgwhite">
        <!-- 公共部分 - header -->
        <header class="pub-header">
            <div class="header-box">
                <input type="text" class="search" placeholder="">
                <a href="./ot-myClass.html">
                    <div class="footprint">足迹</div>
                </a>
                <a href="./ot-signIn.html">
                    <div class="sign-in">签到</div>
                </a>
            </div>
        </header>
        <!-- 公共 - 菜单 -->
        <div class="pub-menu plr15">
            <ul class="menu-list">
                <!-- <li class="menu-item active">
                    <a href="#">推荐</a>
                </li>
                <li class="menu-item">
                    <a href="#">癫痫病</a>
                </li>
                <li class="menu-item">
                    <a href="#">白内障</a>
                </li>
                <li class="menu-item">
                    <a href="#">白内障</a>
                </li>
                <li class="menu-item">
                    <a href="#">癫痫病</a>
                </li>
                <li class="menu-item">
                    <a href="#">白内障</a>
                </li> -->
            </ul>
        </div>
        <!-- 公共 - banner -->
        <div class="pub-banner plr15" id="topBanner">
            <!-- <a href="javascript:;"><img src="image/placeholder/1.jpg" alt=""></a> -->
        </div>
        <!-- 在线会诊流程 -->
        <div class="consultation-step space-border">
            <h2 class="pub-title">在线会诊流程</h2>
            <ul class="step-list">
                <li class="step-item item1"> 填写会诊<br>申请单 </li>
                <li class="step-space"></li>
                <li class="step-item item2"> 咨询确认<br>会诊时间 </li>
                <li class="step-space"></li>
                <li class="step-item item3"> 在线参加<br>远程会诊 </li>
                <li class="step-space"></li>
                <li class="step-item item4"> 查看会诊<br>结果 </li>
            </ul>
        </div>
        <!-- 会诊咨询 -->
        <div class="consultation-customer space-border">
            <div class="inner">
                <textarea class="cont" rows="2" placeholder="输入您想要咨询的会诊内容，进行会诊咨询......" id="purposeTextarea"></textarea>
                <a id="consultBtn" class="btn" href="consultation-apply.html">会诊咨询</a>
            </div>
        </div>
        <!-- 视频 -->
        <div class="consultation-video space-border" id="midBanner">
            <!-- <a href="javascript:;">
                <img src="image/placeholder/1.jpg" alt="">
                <i class="pub-i-play"></i>
            </a> -->
        </div>
        <!-- 成功案例、会诊咨询 -->
        <div class="pub-main consultation-main space-border active1" id="mainBox">
            <!-- 导航 -->
            <ul class="navs clearfloat">
                <li class="nav" id="tab1">成功案例</li>
                <li class="nav" id="tab2">会诊资讯</li>
            </ul>
            <ul class="pub-list" id="contentList">
                <li>
                    <!-- 列表 - 成功案例 -->
                    <div class="list case-list">
                    </div>
                </li>
                <li>
                    <!-- 列表 - 会诊资讯 -->
                    <div class="list new-list">
                    </div>
                </li>
            </ul>
            <div class="weui-loadmore" id="loadMore">
                <i class="weui-loading"></i>
                <span class="weui-loadmore__tips">正在加载</span>
            </div>
            <div class="weui-loadmore weui-loadmore_line hide" id="noMore">
                <span class="weui-loadmore__tips">没有更多数据了</span>
            </div>
        </div>
        <!-- 公共footer -->
        <div class="pub-footer">
            <ul class="tabs">
                <li class="tab-classroom"><a href="./ot-classroom-index.html">首页</a></li>
                <li class="tab-doctor"><a href="./ot-doctor-index.html">名医</a></li>
                <li class="tab-curriculum"><a href="./ot-curriculum-index.html">课程</a></li>
                <li class="tab-forum"><a href="./classroom-index.html">讲堂</a></li>
                <li class="tab-consultation active"><a href="consultation-index.html">会诊</a></li>
                <li class="tab-user"><a href="user.html">我的</a></li>
            </ul>
        </div>
        <!-- 视频播放弹窗 -->
        <div class="video popup">
            <div class="cont" id="player">
            </div>
        </div>
    </div>
    <script src="https://g.alicdn.com/de/prismplayer/2.9.3/aliplayer-h5-min.js"></script>
    <script src="js/jquery-3.6.0.min.js"></script>
    <script src="js/jquery-weui.min.js"></script>
    <script src="js/md5.js"></script>
    <script src="js/public.js"></script>
    <script>
        $('#purposeTextarea').on('keypress', function (e) {
            if (e.keyCode == 13) return false;
        })
        var pageStatus = {
            case: { currentPage: 1, loadEnd: false, getList: getCaseList },
            new: { currentPage: 1, loadEnd: false, getList: getNewList }
        };
        var type = 'case', loading = false;

        // tab切换
        $('#tab1').click(function () {
            type = 'case';
            $('#mainBox').removeClass('active2').addClass('active1');
        })
        $('#tab2').click(function () {
            type = 'new';
            $('#mainBox').removeClass('active1').addClass('active2');
        })

        // 获取广告
        function getBanner() {
            // 获取顶部
            http('/ad/getAllAd', {
                hasToken: false,
                data: {
                    id: '3' // 广告图位置 1 顶部 2 中部
                },
                success: function (res) {
                    if (res.code === '01') {
                        res.data.length > 0 ? $('#topBanner').html(getAdHtml(res.data[0])).show() : $('#topBanner').hide();
                    }
                }
            })
            // 获取中部
            http('/ad/getAllAd', {
                hasToken: false,
                data: {
                    id: '4' // 广告图位置 1 顶部 2 中部
                },
                success: function (res) {
                    if (res.code === '01') {
                        res.data.length > 0 ? $('#midBanner').html(getAdHtml(res.data[0])).show() : $('#midBanner').hide();
                    }
                }
            })
        }

        // 获取案例列表
        function getCaseList() {
            var caseOption = pageStatus.case;
            http('/ad/getAllExample', {
                hasToken: false,
                noEncry: true,
                data: {
                    currentPage: caseOption.currentPage,
                    pageSize: PAGESIZE
                },
                success: function (res) {
                    if (res.code === '01') {
                        var data = res.data, html = '';
                        data.forEach(function (item) {
                            html += '<a href="consultation-detail.html?type=case&id=' + item.exampleId + '">' +
                                '<dl class="item">' +
                                '<dt><img class="case-img" src="' + item.file.uploadUrl + '" alt="' + item.file.uploadName + '"></dt>' +
                                '<dd>' + item.title + '</dd>' +
                                '</dl>' +
                                '</a>';
                        })


                        // 判断是否是最后一页
                        caseOption.loadEnd = (data.length < PAGESIZE);

                        // 判断是否是第一页
                        caseOption.currentPage === 1 ? $('.case-list').html(html) : $('.case-list').append(html);

                        caseOption.currentPage++;
                    }
                },
                complete: function () {
                    loading = false;
                }
            })
        }

        // 获取资讯列表
        function getNewList() {
            var newOption = pageStatus.new;
            http('/ad/getAllNews', {
                hasToken: false,
                noEncry: true,
                data: {
                    id: 2,
                    currentPage: newOption.currentPage,
                    pageSize: PAGESIZE
                },
                success: function (res) {
                    if (res.code === '01') {
                        var data = res.data, html = '';
                        data.forEach(function (item) {
                            html += '<a href="consultation-detail.html?type=new&id=' + item.newsId + '">' +
                                '<dl class="item">' +
                                '<dt><h3>' + item.title + '</h3></dt>' +
                                '<dd class="info">' +
                                '<div class="text cut2">' + item.detail + '</div>' +
                                '<p class="date">' + format(item.createTime) + '</p>' +
                                '<div class="img">' +
                                '<img src="' + item.file.uploadUrl + '" alt="' + item.file.uploadName + '">'
                            if (item.videoId) {
                                html += '<i class="pub-i-play small"></i>'
                            }
                            html += '</div>' +
                                '</dd>' +
                                '</dl>' +
                                '</a>';
                        })

                        // 判断是否是最后一页
                        newOption.loadEnd = (data.length < PAGESIZE);

                        // 判断是否是第一页
                        newOption.currentPage === 1 ? $('.new-list').html(html) : $('.new-list').append(html);

                        newOption.currentPage++;
                    }
                },
                complete: function () {
                    loading = false;
                }
            });
        }

        getBanner();
        getCaseList();
        getNewList();

        // 会诊咨询
        $('#consultBtn').click(function () {
            sessionStorage.setItem('consultCont', $(this).siblings('textarea').val());
        })

        // 加载更多
        $(document.body).infinite().on("infinite", function (e) {
            if (loading) return;
            var currOption = pageStatus[type];
            if (currOption.loadEnd) {
                $('#noMore').show();
                $('#loadMore').hide();
            } else {
                $('#noMore').hide();
                $('#loadMore').show();
                loading = true;
                currOption.getList();
            }
        });

        getData()
        function getData(type) {
            gethttp('/ld/home?type=c', {
                success: function (res) {
                    let hotDiseases = res.data.hotDiseases
                    hotDiseases.forEach((item, index) => {
                        if (item.name == '空') {
                            return false
                        }
                        $('.menu-list').append(`<li class="menu-item">
                                                <a href="ot-doctor-index.html?search=${item.name}">${item.name}</a>
                                            </li>`)
                    })
                }
            })
        }
    </script>
</body>

</html>